//
//  CanchaCreator.m
//  Futbol5Final
//
//  Created by Johan Chaves on 4/14/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "CanchaCreator.h"
#import "LocalVO.h"
#import "CanchaVO.h"

@implementation CanchaCreator

-(NSMutableArray *) createCanchas:(LocalVO*)plocal :(NSDictionary *)canchasData{
    NSMutableArray * canchasResult = [[NSMutableArray alloc]init];
    

    
    CanchaVO *canchaVoTmp;
    
    NSMutableDictionary *canchaTmp = [[NSMutableDictionary alloc]init];
    
    NSString *ids;
    
    NSEnumerator *arrenum = [canchasData objectEnumerator];
    id cobj;   
    
    while ( cobj = [arrenum nextObject] ) {            
        
        [canchaTmp setDictionary:cobj];
        ids = [canchaTmp objectForKey:@"id_cancha"];
        
      
        canchaVoTmp = [[CanchaVO alloc]initWithData:plocal: [canchaTmp objectForKey:@"reservaciones"]:[canchaTmp objectForKey:@"nombre"]:[[canchaTmp objectForKey:@"hora_apertura"]intValue] :[[canchaTmp objectForKey:@"hora_cierre"]intValue]:UITableViewCellStyleDefault :[ids intValue] reuseIdentifier:@"disitrito"];            
        
        
        [canchasResult addObject:canchaVoTmp];
        
        
        [canchaVoTmp release];
        [ids release];
        
    }
    
    [canchaTmp release];
    [cobj release];
    
    return canchasResult;
}

@end
